<template>
  <div class="home">
    <!-- 头部 -->
    <div class="header">一条街</div>
    <!-- 轮播 -->
    <div class="banner-in">
      <van-swipe :autoplay="3000" height="215" indicator-color="#d43e2e">
        <van-swipe-item v-for="(image, index) in banner" :key="index">
          <img v-lazy="image.image" />
        </van-swipe-item>
      </van-swipe>
    </div>
    <!-- 十点抢券 -->
    <div class="list">
      <ul class="list-in">
        <li v-for="(item,index) in recommend" :key="index">
          <img :src="item.image" alt />
          <p>{{item.title}}</p>
        </li>
      </ul>
    </div>
    <!-- 本周流行 -->
    <div class="weekChao">
      <h3 class="title">本周流行</h3>
      <ul class="weekChao-in">
        <li v-for="(item,index) in keywords" :key="index">
          <img src="https://img1.baidu.com/it/u=3587961201,3488817730&fm=253&fmt=auto&app=138&f=JPEG?w=589&h=500" alt />
          <p>{{item.words}}</p>
        </li>
      </ul>
    </div>
    <!-- 产品 -->
    <Protect />
  </div>
</template>

<script>
import Protect from "@/views/homePage/Protect.vue";
import { BannerApi } from "@/request/api";
export default {
  data() {
    return {
      // 轮播图数据
      banner: [],
      // 十点抢券
      recommend: [],
      //本周流行
      keywords: [],
     
    };
  },
  created() {
    BannerApi().then(res => {
      if (res.status == 200) {
        console.log(res.data.data);
        /* 轮播图数据 */
        this.banner = res.data.data.banner.list;
        /* 十点抢券 */
        this.recommend = res.data.data.recommend.list;
        /* 本周流行 */
        this.keywords = res.data.data.keywords.list;
      }
    });
   
  },
  components: {
    Protect
  }
};
</script>
 
<style lang = "less" scoped>
.home {
  /* position: relative; */
  .header {
    width: 100%;
    height: 45px;
    background-color: #ff8198;
    line-height: 45px;
    text-align: center;
    font-size: 16px;
    color: #ffffff;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
  }
  .banner-in {
    height: 215px;
    width: 100%;
    img {
      width: 100%;
      height: 215px;
      display: block;
    }
  }
  .list {
    width: 100%;
    height: 136px;
    background-color: #ffffff;
    /* padding: 0 10px; */
    .list-in {
      width: 100%;
      height: 136px;
      display: flex;
      justify-content: space-around;
      align-items: center;
      li {
        text-align: center;
        img {
          width: 70px;
          height: 70px;
        }
        p {
          margin-top: 5px;
          font-size: 12px;
          color: #666666;
        }
      }
    }
  }
  .weekChao {
    width: 100%;
    height: 305px;
    background-color: #ffffff;
    margin-top: 10px;
    .title {
      padding: 15px 0;
      text-align: center;
      font-size: 18px;
      color: #000;
      font-weight: 600;
    }
    .weekChao-in {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      width: 100%;
      height: 305px;
      padding: 0 20px;
      box-sizing: border-box;
      li {
        text-align: center;
        img {
          width: 80px;
          height: 80px;
          border-radius: 50%;
        }
        p {
          margin-top: 5px;
          color: #979797;
          font-size: 14px;
        }
      }
    }
  }
}
</style>